module StarFrame
  class Sprite
    class Collision
      class Circle < Collision
        attr_reader :x, :y, :radius
        
        def initialize target, method_name, x, y, radius
          @x, @y, @radius = x, y, radius
          super
        end
        
        def collide? other
          case other
          when Circle
            radius = @radius+other.radius
          when Dot
            radius = @radius
          else
            return super
          end
          Collision.dot_in_circle?(other.position, [position, radius])
        end
      end
    end
  end
end
